/* Copyright (C) 2005, 2006 by Daniel Gheorghian
 All rights reserved
 
 Use and distribute freely, except: don't remove my name from the source or documentation 
 (don't take credit for my work), mark your changes (don't get me blamed for your possible bugs),
 don't alter or remove this notice.
 
 No warrantee of any kind, express or implied, is included with this software; use at your
 own risk, responsibility for damages (if any) to anyone resulting from the use of this
 software rests entirely with the user.
 
 Send bug reports, bug fixes, enhancements, requests, flames, etc., and I'll try to keep 
 a version up to date.  I can be reached at: daniel.gheorghian@gmail.com
*/
package com.ds.renderer;

import java.awt.*;

public class ResultGridHeaderRenderer implements HeaderRenderer
{
	private final int HEADER_HEIGHT = 15;
	private final int HEADER_WIDTH = 100;

	private int hOffset;
	private int vOffset;
	private String percentage="";
	private boolean solution;

	public void renderHeader(Graphics g, int cellWidth, int cellHeight, int columnsNo, int rowsNo)
	{
		Graphics2D g2D = ( Graphics2D ) g;
		g2D.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );

		if( solution )
		{
			g2D.setColor( Color.red );
			g2D.setFont( new Font( "Arial", Font.BOLD, 12 ) );
		}
		else
		{
			g2D.setColor( Color.orange );
			g2D.setFont( new Font( "Arial", Font.BOLD, 11 ) );
		}
		g2D.drawString( percentage, 10,10 );
	}

	public Dimension getHeaderSize()
	{
		return new Dimension( HEADER_WIDTH, HEADER_HEIGHT );
	}

	public void setHOffset(int hOffset)
	{
		this.hOffset = hOffset;
	}

	public int getHOffset()
	{
		return this.hOffset;
	}

	public void setVOffset(int vOffset)
	{
		this.vOffset = vOffset;
	}

	public int getVOffset()
	{
		return this.vOffset;
	}

	public void setPercentage(String percentage)
	{
		this.percentage = percentage;
	}

	/**
	 * @return the solution
	 */
	public boolean isSolution() {
		return solution;
	}

	/**
	 * @param solution the solution to set
	 */
	public void setSolution(boolean solution) {
		this.solution = solution;
	}
}
